
function fn(arr1,arr2)
{
  var len = Math.max(arr1.length,arr2.length);
  var arr = [];

  for (var i = 0; i < len; i++)
  {
    if (arr1[i] != undefined) {
      arr.push(arr1[i]);
    }

    if (arr2[i] != undefined) {
      arr.push(arr2[i]);
    }
  }
  console.log(arr);
}

fn([1,2,3],[4,5,6]);
